package it.test.java.function;

/**
 * 找出数组中相加等于target的两个元素，返回下表
 * @Copyright 纳新智能科技有限公司
 * @Author Liky
 * @Date 2023/2/14
 */
public class Solution1 {
    public int[] twoSum(int[] nums, int target) {
        for (int a = 0; a < nums.length; a++) {
            for (int b = a + 1; b < nums.length; b++) {
                if (nums[a] + nums[b] == target) {
                    return new int[]{a, b};
                }
            }
        }
        return new int[]{};
    }
}
